﻿using System;
using UnityEngine;



public class SwordsmanBehaviorModeBest : MonsterBehaviorModeBest<SwordsmanBehaviorScoreModeBest>
{
    protected Swordsman swordsman;

    protected override void Awake()
    {
        base.Awake();
        swordsman = monster as Swordsman;
    }

    public void ThumpAttackBehavior()
    {
        GameObject target = GetAttackTargetPlayer();
        if (target != null)
        {
            MonsterTaskProcessor.Instance.AddTaskBack(new SwordsmanTaskThumpAttack(swordsman, null));
        }
    }


    public void StabAttackBehavior()
    {
        GameObject target = GetTargetPlayer();
        if (target != null && swordsman.IsGround && !swordsman.IsInStabAttackCD())
        {
            if (transform.eulerAngles.y == 0 && target.transform.position.x < swordsman.transform.position.x)
            {
                transform.eulerAngles = new Vector3(0.0f, 180.0f, 0.0f);
            }
            else if (transform.eulerAngles.y == 180 && target.transform.position.x > swordsman.transform.position.x)
            {
                transform.eulerAngles = new Vector3(0.0f, 0.0f, 0.0f);
            }

            MonsterTaskProcessor.Instance.AddTaskBack(new SwordsmanTaskStabAttack(swordsman, null, hunchRangeRadius * 2));
        }
    }
}
